require 'ie_select_width_fixer'

# Copy in these javascript files when this plugin gets loaded each time
if Object.const_defined?("RAILS_ENV") && RAILS_ENV != "test"
  width_js_root = File.join(RAILS_ROOT, "public", "javascripts", "ie_select")
  width_js_plugin_root = File.join(File.dirname(__FILE__), "public", "javascripts")
  
  unless File.directory?(width_js_root)
    FileUtils.mkdir_p(width_js_root)
  end
  
  if File.exists?(width_js_root)
    FileUtils.copy(File.join(width_js_plugin_root, "dom_2.0.2-b3.js"), width_js_root)
    FileUtils.copy(File.join(width_js_plugin_root, "event_2.0.0-b3.js"), width_js_root)
    FileUtils.copy(File.join(width_js_plugin_root, "yahoo_2.0.0-b3.js"), width_js_root)
    FileUtils.copy(File.join(width_js_plugin_root, "ie-select-width-fix.js"), width_js_root)
  end
end